package com.vclee.fast.integration.imserver;


import com.vclee.fast.integration.imserver.PushUtils;
import com.vclee.fast.utils.exception.Assert;
import com.vclee.fast.utils.model.Bson;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.vclee.fast.utils.JwtUtils;
import com.vclee.fast.utils.aspect.SysLog;
import com.vclee.fast.utils.exception.R;


@RestController
@RequestMapping("im-service/msg")
public class ImCenterController {
    @Value("${custom.im-url:ws://127.0.0.1:8050/imServer/}")
    private String wss;

    @SysLog("连接IM服务")
    @PostMapping("getImAddress")
    public R getImAddress(@RequestBody Bson params) {
        String platform = params.getString("platform");
        Assert.isBlank(platform, "平台参数不存在");
        return R.ok(wss+ PushUtils.getPlatform(platform)+JwtUtils.getUserId());
    }

}
